package com.neusoft.chenhanhua.d0922;

public class Tonbu implements Runnable {
        private int i=100;
        
	@Override
	public void run() {
		while (true) {
			//同步代码块即可,为什么加入synchronized以后，判断条件要加
			synchronized (this) {
				if (i>=1) {
					
					System.out.println(Thread.currentThread() + "卖了第" + i + "张票");
					--i;
				} else {
                      break;
				}
			}
		}
		
	}
	

}
